dofile("fenetre.lua")

fenetre = {}
 
fenetre[1] = Creer_fenetre(square(10,10,200,100))
fenetre[2] = Creer_fenetre(square(20,20,210,110),"La seconde",SCREEN_DOWN)

k_re = square(0,0,0,0)

cBlanc = Color.new(31,31,31)
cNoir = Color.new(0,0,0)
quit = true
fenetre[1].titre = "Le plus grand titre de la fenetre"

while quit do
   Controls.read()
   startDrawing ()
   Show_fenetre(fenetre[1])
   k_re = Retourne_squareUtil(fenetre[1])
   if not estReduite(fenetre[1]) then
      screen.drawFillRect(fenetre[1].ecran,k_re.x1,k_re.y1,k_re.x2,k_re.y2,cBlanc)
      screen.print(fenetre[1].ecran,k_re.x1+10,k_re.y1+10,"Fenetre principale",cNoir)
   end
   Show_fenetre(fenetre[2])
   k_re = Retourne_squareUtil(fenetre[2])
   if not estReduite(fenetre[2]) then
      screen.drawFillRect(fenetre[2].ecran,k_re.x1,k_re.y1,k_re.x2,k_re.y2,cBlanc)
      screen.print(fenetre[2].ecran,k_re.x1+10,k_re.y1+10,"Fenetre secondaire",cNoir)
   end
   res = Held_fenetre(fenetre[1])
   Held_fenetre(fenetre[2])
--   if Keys.newPress.R then
   if Keys.newPress.Y then
      screen_switch(fenetre[1])
      screen_switch(fenetre[2])
   end
   if Keys.newPress.A then
      if fenetre[1].bTitre then
         fenetre[1].bTitre = false
      else
         fenetre[1].bTitre = true
      end
   end
   if Keys.newPress.B then
      if fenetre[1].bClose then
         fenetre[1].bClose = false
      else
         fenetre[1].bClose = true
      end
   end
   if Keys.newPress.X then
      if fenetre[1].bChange then
         fenetre[1].bChange = false
      else
         fenetre[1].bChange = true
      end
   end
--   if Keys.newPress.Y then
--      if fenetre[1].reduite then
--         fenetre[1].reduite = false
--      else
--         fenetre[1].reduite = true
--      end
--   end
   if res == _CLOSE then
      quit = false
   end
   screen.print(SCREEN_UP,0,0,"Haut")
   screen.print(SCREEN_DOWN,0,0,"Bas")
   stopDrawing ()
end

Del_fenetre(fenetre[1])
Del_fenetre(fenetre[1])
rec_fen = nil
fenetre = nil
k_re = nil
cBlanc = nil
quit = nil
res = nil
collectgarbage("collect")

